/********************************
 * @FileName:     Dialect.java
 * @Description:  Dialect.java -
 * @Copyright:    Copyright(C) 2010-2011 mbool.com
 * @Company       MBOOL-TEAM zhangjiayi LTD.
 * @author:       zhangjiayi
 * @version       V1.0 
 * @Createdate:   2016-5-9 下午9:52:17
 *
 * All rights Reserved, Designed By MBOOL-TEAM
 *
 * Modification  History:
 * Date         Author        Version        Discription
 * -----------------------------------------------------------------------------------
 * 2016-5-9       zhangjiayi       1.0         TODO
 * Why & What is modified: <修改原因描述>
 *
 ********************************/
package com.rowline.admin.module.util.data.dialect;

/**
 * @ClassName: Dialect
 * @Description: 类似hibernate的Dialect,但只精简出分页部分
 * @author: zhangjiayi
 * @date: 2016-5-9 下午9:52:17
 * 
 */
public class Dialect {
	public boolean supportsLimit() {
		return false;
	}

	public boolean supportsLimitOffset() {
		return supportsLimit();
	}

	/**
	 * ***
	 * @Title:       getLimitString
	 * @Description: 将sql变成分页sql语句,直接使用offset,limit的值作为占位符.
	 * @param sql
	 * @param offset
	 * @param limit
	 * @return   
	 * @return:      String   
	 * @throws: 
	 * @date:	     2016-5-9 下午9:55:14
	 ****
	 */
	public String getLimitString(String sql, int offset, int limit) {
		return getLimitString(sql, offset, Integer.toString(offset), limit,
				Integer.toString(limit));
	}

	/**
	 * ***
	 * @Title:       getLimitString
	 * @Description: 将sql变成分页sql语句,提供将offset及limit使用占位符(placeholder)替换.
	 * @param sql
	 * @param offset
	 * @param offsetPlaceholder
	 * @param limit
	 * @param limitPlaceholder
	 * @return   
	 * @return:      String   
	 * @throws: 
	 * @date:	     2016-5-9 下午9:55:28
	 ****
	 */
	public String getLimitString(String sql, int offset,
			String offsetPlaceholder, int limit, String limitPlaceholder) {
		throw new UnsupportedOperationException("paged queries not supported");
	}

	public String getLimitString(String sql, int limit) {
		return sql;
	}
}
